Fix exception "committed argument cannot be less than 0"#24203
Open
LinHu2016 wants to merge 1 commit into
Open
Fix exception "committed argument cannot be less than 0"#24203LinHu2016 wants to merge 1 commit into
LinHu2016 wants to merge 1 commit into
Conversation
fd28666 to
7bfd9a9
Compare
Previous PR eclipse-openj9#17107 target to prevent exception "committed argument cannot be less than 0" for MemoryPool "balanced-reserved" during collecting memoryUsage at the end of GC(balanced GC only), but there are two special cases haven't been covered. Fix case 1: maxHeapExpansionRegions could add on maxEdenChange and use _extensions->globalVLHGCStats._heapSizingData.edenRegionChange to notify heap resize to adjust heap size to match eden change, but it did not consider the case which eden size is bigger than free memory, so update _extensions->globalVLHGCStats._heapSizingData.edenRegionChange = OMR_MIN(maxHeapExpansionRegions, edenChangeWithSurvivorHeadroom + (intptr_t)(_edenRegionCount - freeRegions)); for keeping free memory >= eden size after heap resize. Fix case 2: eden region can not be smaller than 1, when free region is 0 eden region size can be 0. Add Assertion checks to confirm free size >= eden size. Update to correct freeTenure at the beginning of PGC should count out free eden size(for most case, free eden would be closed to 0, but in some cases free eden is significant, it might confuse the heap resize algorithm). - In performResize() in case there is no heap resize, check if there is the case that free size is small than eden size due to the conflict between eden resize and heap resize, reCalculateEdenSize if it happens. - Fix zero-eden resize conflict in Balanced heap sizing. calculateEdenSize() to size eden using both current free regions and potential heap expansion. In the conflict case where eden sizing wants more expansion than heap sizing permits, eden is later recalculated without heap expansion allowance. If the post-heap-resize free space is zero, that recalculation can clamp eden to zero, which then leads to OOM. Fix this in checkResize() by detecting the zero-free-space conflict case before resize is finalized. When eden requires more growth than the chosen heap resize provides, and the resulting free space after heap resize would be zero, adjust the heap resize to edenSize - freeSize so the previously computed eden size is preserved. Signed-off-by: lhu <linhu@ca.ibm.com>
7bfd9a9 to
1e51e89
Compare
Contributor
Author
|
@amicic @dmitripivkine please review the changes, Thanks |
amicic
reviewed
Jun 23, 2026
| return _schedulingDelegate.getCurrentEdenSizeInBytes(env); | ||
| } | ||
|
|
||
| MMINLINE void reCalculateEdenSize(MM_EnvironmentVLHGC *env) |
Contributor
There was a problem hiding this comment.
fix spelling recalculateEdenSize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previous PR #17107 target
to prevent exception "committed argument cannot be less than 0" for
MemoryPool "balanced-reserved" during collecting memoryUsage at the end
of GC(balanced GC only), but there are two special cases haven't been
covered.
Fix case 1: maxHeapExpansionRegions could add on maxEdenChange and use
_extensions->globalVLHGCStats._heapSizingData.edenRegionChange to notify
heap resize to adjust heap size to match eden change, but it did not
consider the case which eden size is bigger than free memory, so update
_extensions->globalVLHGCStats._heapSizingData.edenRegionChange =
OMR_MIN(maxHeapExpansionRegions, edenChangeWithSurvivorHeadroom +
(intptr_t)(_edenRegionCount - freeRegions));
for keeping free memory >= eden size after heap resize.
Fix case 2: eden region can not be smaller than 1, when free region is 0
eden region size can be 0.
Add Assertion checks to confirm free size >= eden size.
Update to correct freeTenure at the beginning of PGC
should count out free eden size(for most case, free eden would be
closed to 0, but in some cases free eden is significant, it might
confuse the heap resize algorithm).
In performResize() in case there is no heap resize, check if there is
the case that free size is small than eden size due to the conflict
between eden resize and heap resize, reCalculateEdenSize if it happens.
Fix zero-eden resize conflict in Balanced heap sizing.
calculateEdenSize() to size eden using both current free regions and
potential heap expansion. In the conflict case where eden sizing wants
more expansion than heap sizing permits, eden is later recalculated
without heap expansion allowance. If the post-heap-resize free space is
zero, that recalculation can clamp eden to zero, which then leads to
OOM. Fix this in checkResize() by detecting the zero-free-space conflict
case before resize is finalized. When eden requires more growth than the
chosen heap resize provides, and the resulting free space after heap
resize would be zero, adjust the heap resize to edenSize - freeSize so
the previously computed eden size is preserved.
fix : #23875
fix : #24037
fix : #22440
Signed-off-by: lhu linhu@ca.ibm.com